<div id="supplement"></div>

<%= spinner %>

<table class="table">
  <thead>
    <tr>
      <th class="first"><%= sort_link search, :attachment_file_name, "#{t 'helpers.label.supplement.attachment_file_name'}" %></th>
      <th><%= sort_link search, :name, "#{t 'helpers.label.supplement.name'}" %></th>
      <th><%= sort_link search, :attachment_content_type, "#{t 'helpers.label.supplement.attachment_content_type'}" %></th>
      <th><%= sort_link search, :attachment_file_size, "#{t 'helpers.label.supplement.attachment_file_size'}" %></th>
      <th class="last"></th>
    </tr>
  </thead>
  <tfoot>
    <tr>
      <th colspan="´10"><%= remote_button_to_new 'Nahrát novou přílohu', new_admin_product_product_supplement_path(params[:product_id]), "supplement" %></th>
    </tr>
  </tfoot>
  <tbody>
    <% unless search.all.blank? %>
      <%= render :partial => "supplement", :collection => search.all %>
    <% else %>
    <tr>
      <th colspan="10">Nebyly nalezeny žádné přílohy</th>
    </tr>
    <% end %>
  </tbody>
</table>

<script type="text/javascript">
  jQuery(function() {
    var toggleSpinner = function() {$("#spinner").toggle()};

    $(".supplement")
      .bind("ajax:beforeSend", toggleSpinner)
      .bind("ajax:complete", toggleSpinner);
  });
</script>